home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: prcc85.eng.prt.alcatel.pt!slspu2!news
- From: lve163d@slsufnt.stgl.sel.alcatel.de (Oliver Boehm KS/ESF1 +49-711-821-47013)
- Subject: Re: Leap Years
- Message-ID: <DMrBBx.4pI@slspu2.stgl.sel.alcatel.de>
- Sender: news@slspu2.stgl.sel.alcatel.de
- Reply-To: OBoehm@stgl.sel.alcatel.de
- Organization: ALCATEL SEL Stuttgart
- References: <8BA8405.02C70020E1.uuout@sourcebbs.com>
- Date: Wed, 14 Feb 1996 08:23:57 GMT
-
-
- In article <8BA8405.02C70020E1.uuout@sourcebbs.com>, david.mohorn@sourcebbs.com (DAVID MOHORN) writes:
- > Subject: Leap Years
- > Date: Sat, 10 Feb 96 17:09:00 -0500
- > Distribution: world
- > Reply-To: david.mohorn@sourcebbs.com (DAVID MOHORN)
- > X-Newsreader: PCBoard Version 15.22
- > X-Mailer: PCBoard/UUOUT Version 1.20
- >
- > How do you feature out leap years? If its evenly divisible by 400 and
- > 4?
-
- years divisible by 100 are no leap years. Here two macros for that problem:
-
- #define LEAP_YEARS(y) (y) / 4 - (y) / 100 + (y) / 400
- /* number of leap years since the year 0 */
- #define IS_LEAP_YEAR(y) ((((y) % 4) == 0) && (((y) % 100) != 0)) || \
- ((((y) % 4) == 0) && (((y) % 400) == 0))
-
- Regrads
- Oliver
- ------------------------------------------------v----------
- Oliver Boehm OBoehm@stgl.sel.alcatel.de | No RISC -
- boehm@ba-stuttgart.de | No FUN
- ------------------------------------------------^----------
-
-